<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--Converted with LaTeX2HTML 96.1 (Feb 5, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->


<title>Polly the Polynomial</title>
<meta name="description" content="Polly the Polynomial">
<meta name="keywords" content="htmlatex">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<link rel="STYLESHEET" href="acm-00498_files/htmlatex.css">
</head><body bgcolor="#ffffff" lang="EN">
 <h1><br clear="all"><center><table bgcolor="#0060f0"><tbody><tr><td><b><font color="#c0ffff" size="5">&nbsp;<a name="SECTION0001000000000000000000">Polly the Polynomial</a></font>&nbsp;</b></td></tr></tbody></table></center></h1>
<p>
Algebra! Remember algebra? There is a theory that as engineers
progresses further and further in their studies, they lose basic math
skills. This problem is designed to help you remember those <em>basic</em> algebra skills,
make the world a better place, etc., etc.
</p><p>
</p><h2><font color="#0070e8"><a name="SECTION0001001000000000000000">Input</a></font></h2>
<p>
Your program should accept an even number of lines of text. Each pair
of lines will represent one problem. The first line will contain a list
of integers { <img alt="tex2html_wrap_inline27" src="acm-00498_files/498img1.gif" align="middle" height="17" width="92"> } which represent a set of coefficients to a polynomial expression. The order of the polynomial is <i>n</i>. The coefficients should be paired with the terms
of the polynomial in the following manner:
</p><p> <img alt="displaymath31" src="acm-00498_files/498img2.gif" align="bottom" height="18" width="350"> </p><p>
</p><p>
The second line of text represents a sequence of values for <i>x</i>, { <img alt="tex2html_wrap_inline35" src="acm-00498_files/498img3.gif" align="middle" height="17" width="102"> }.
</p><p>
</p><h2><font color="#0070e8"><a name="SECTION0001002000000000000000">Output</a></font></h2>
<p>
For each pair of lines, your program should evaluate the polynomial for all the values of <i>x</i> ( <img alt="tex2html_wrap_inline39" src="acm-00498_files/498img4.gif" align="middle" height="17" width="15">  through  <img alt="tex2html_wrap_inline41" src="acm-00498_files/498img5.gif" align="middle" height="17" width="20"> ) and output the resulting values on a single line.
</p><p>
</p><h2><font color="#0070e8"><a name="SECTION0001003000000000000000">Sample Input</a></font></h2>
<p>
</p><pre>-2
5 0 1 6
1 -1
7 6 -1</pre>
<p>
</p><h2><font color="#0070e8"><a name="SECTION0001004000000000000000">Sample Output</a></font></h2>
<p>
</p><pre>-2 -2 -2 -2
6 5 -2</pre>
<p>
</p></body></html>